package com.medicine.hbp.ui;

import java.util.ArrayList;
import java.util.List;

import org.kymjs.kjframe.ui.BindView;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.medicine.hbp.adapter.FragmentAdapter;
import com.medicine.hbp.base.BaseActivity;
import com.medicine.hbp.fragment.advice.FeedbackFragment;
import com.medicine.hbp.R;
/**
 * 意见反馈
 * @author yusuojindan
 */
public class AdviceActivity extends BaseActivity{

//	@BindView(id = R.id.ll_common_problems, click = true)
//	public LinearLayout ll_common_problems;
//	@BindView(id = R.id.ll_my_opinion, click = true)
//	public LinearLayout ll_my_opinion;
//	@BindView(id = R.id.img_common_problems, click = true)
//	public ImageView img_common_problems;
//	@BindView(id = R.id.img_my_opinion, click = true)
//	public ImageView img_my_opinion;

	@BindView(id = R.id.view_page, click = false)
	public ViewPager mViewPage;
	@Override
	public void setRootView() {
		super.setRootView();
		setContentView(R.layout.activity_advice);
	}
	// Fragment管理器
	private FragmentManager manager;
	@Override
	public void initWidget() {
		super.initWidget();
		//获取Fragment管理器
		List<Fragment> listf = new ArrayList<Fragment>();
		Fragment fragmentFeedback=new FeedbackFragment();
		listf.add(fragmentFeedback);
//		Fragment fragmentArticle=new FeedbackFragment();
//		listf.add(fragmentArticle);
		FragmentAdapter adapter=new FragmentAdapter(this.getSupportFragmentManager(), listf);
		mViewPage.setAdapter(adapter);
//		mViewPage.setOnPageChangeListener(new OnPageChangeListener() {
//			@Override
//			public void onPageSelected(int id) {
//				if(id==0){
//					setImage(R.drawable.guanzhu_02, R.drawable.guanzhu_01);
//				}else if(id==1){
//					setImage(R.drawable.guanzhu_01, R.drawable.guanzhu_02);
//				}
//			}
//			@Override
//			public void onPageScrolled(int arg0, float arg1, int arg2) {
//			}
//			@Override
//			public void onPageScrollStateChanged(int arg0) {
//			}
//		});
//		mViewPage.setCurrentItem(0);
		initTop();
	}
	@Override
	public void widgetClick(View v) {
		super.widgetClick(v);
//		switch (v.getId()) {
//		case R.id.ll_common_problems://
//			setImage(R.drawable.guanzhu_01, R.drawable.guanzhu_02);
//			mViewPage.setCurrentItem(0);
//			break;
//		case R.id.ll_my_opinion://
//			setImage(R.drawable.guanzhu_02, R.drawable.guanzhu_01);
//			mViewPage.setCurrentItem(1);
//			break;
//		}
	}
	//	/**
//	 * 按钮切换
//	 */
//	private void setImage(int fensi, int guanzhu) {
//		img_common_problems.setImageResource(fensi);
//		img_my_opinion.setImageResource(guanzhu);
//	}
	private void initTop() {
		TopView topview = (TopView) findViewById(R.id.topview);
		topview.setTitle("建议反馈");
		topview.setLeftVisibility(View.GONE);
		topview.setLeftVisibilityExit(View.VISIBLE);
		topview.setRightVisibility(View.INVISIBLE);
		topview.setLeftOnClickExit(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				finish();
			}
		});
	}
}
